/*************************************************************************
	> File Name: oj-546_摆花.cpp
	> Author: Wang Bo
	> Mail: 1276106221@qq.com
	> Created Time: 2021年02月07日 星期日 16时59分56秒
 ************************************************************************/
#include <cstdio>
#include <iostream>
using namespace std;
#define MAX_N 100
const int mod = 1e6 + 7;
int n, m, num[MAX_N + 5], dp[MAX_N + 5][MAX_N + 5];
//状态定义
// dp[i][j]
//

int main() {
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> num[i];
    }
    for (int i = 0; i <= num[0]; ++i) {
        dp[0][i] = 1; //初始化dp[0][i]
    }
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j <= m; ++j) {
            for (int k = 0; k <= num[i]; ++k) {
                printf("dp[%d][%d] <%d> +=", i, j, dp[i][j]);
                printf("dp[i(%d) - 1][j(%d) - k(%d)] <%d> = ", 
                       i, j, k, dp[i - 1][j - k]);
                dp[i][j] += dp[i - 1][j - k];
                printf("dp[%d][%d] = %d\n", i, j, dp[i][j]);
                dp[i][j] %= mod;
                if (j == k) break;
            }
        }
    }
    cout << dp[n - 1][m] << endl;
    return 0;
}
